﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class JOINT_frmJ_JointCompBasicInfoRef : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ((JOINT_MstPage_JOINT)this.Master).changeTitle("送出し機関情報");
        ((JOINT_MstPage_JOINT)this.Master).HideLiArea("frmJ_JointCompBasicInfoRef");
        if (!IsPostBack)
        {
            // Not login
            if (Session["役"] == null || Session["役"].ToString() == "")
            {
                Response.Redirect("~/frmD_Login.aspx");
            }

            // Check define page to page frmJ_JointCompBasicInfoRef
            if ((Session["frmJ_MCompManager_Flag"] == null || Session["frmJ_MCompManager_Flag"].ToString() == "") && (Session["frmJ_IntroCompManager_Flag"] == null || Session["frmJ_IntroCompManager_Flag"].ToString() == ""))
            {
                Response.Redirect("frm_MJointCompManager.aspx");
            }
            
        }
    }

    protected void lbtn_修正_Click(object sender, EventArgs e)
    {
        /*
         Coder: Thanh Dong
         Date: 2012/04/05
         */

        if (Session["役"] != null && Session["役"].ToString()!="1")
        {
            if (Session["frmJ_MCompManager_Flag"] != null && Session["frmJ_MCompManager_Flag"].ToString() == "1")
            {
                Session["frmJ_JointCompBasicInfoRef_update"] = "update";
                Session["frmJ_JointCompBasicInfoRef_Mode"] = "1"; // from page MComManager
                Response.Redirect("frmJ_CompBasicInputCheck.aspx");
            }
            if (Session["frmJ_IntroCompManager_Flag"] != null && Session["frmJ_IntroCompManager_Flag"].ToString() == "1")
            {
                Session["frmJ_JointCompBasicInfoRef_ID"] = Request.Params["id"].ToString(); // Not ID Login <> Session["企業コード_2"]
                Session["frmJ_JointCompBasicInfoRef_Mode"] = "2"; // from page IntroMComManager
                Response.Redirect("frmJ_IntroCompBasicInputCheck.aspx");
            }
        }
    }

    protected string ProsscessLink(string str_Link)
    {
        string str_Result = "";
        for (int i = str_Link.Length; i > 0; i--)
        {
            if (str_Link.IndexOf("/", i) != -1)
            {
                str_Result = str_Link.Substring(i+1);
                return str_Result;
            }
        }
        return str_Result;
    }
}
